<?php
include "../lib/DAL/ChuongTrinhDaoTao.php";
class ChuongTrinhDaoTaoBLL{
    function __construct(){
        
    }
    
    function __destruct(){
        
    }
    public function setCTDT($row){
        $allCTDT=new ChuongTrinhDaoTao();
        $allCTDT->setCTDT($row['ma_ctdt'],$row['ten_td'],$row['ten_hedt'],$row['ten_nganh']);
        return $allCTDT;
    }
    public function getAllCTDT(){
        $sql="SELECT C.ma_ctdt,T.ten_td,H.ten_hedt,N.ten_nganh
              FROM tbl_ctdt as C 
              INNER JOIN dm_trinhdo as T ON C.madm_td=T.madm_td
              INNER JOIN dm_hedaotao as H ON C.madm_hdt=H.madm_hdt
              INNER JOIN dm_nganh as N ON C.madm_nganh=N.madm_nganh";
        $result = mysql_query($sql) or die(mysql_error());
        $arr_ctdt = array();
        while($row = mysql_fetch_array($result)){
            $arr_ctdt[] = $this->setCTDT($row);
        }
        return $arr_ctdt;
    }
}
?>